@extends('layouts.layouts')
@section('title')
    <title>后台首页</title>
@endsection
@section('content')
<style type="text/css">
table{ 
width:200px; 
table-layout: fixed; 
} 
.autocut{ 
cursor: pointer;
overflow:hidden; 
white-space:nowrap; 
text-overflow:ellipsis; 
-o-text-overflow:ellipsis; 
-icab-text-overflow: ellipsis; 
-khtml-text-overflow: ellipsis; 
-moz-text-overflow: ellipsis; 
-webkit-text-overflow: ellipsis; 
} 
.sweet-alert h2{font-size:12px;text-align:left;line-height: 20px;}
.content_click{color:red;}
</style>
    <div class="content">
        <div class="header">
            <ul class="breadcrumb">
                <li><a href="/comment/article">文章评论管理</a></li>
                <li class="active">文章评论列表</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline" action="" method="get">
                    <a href="/comment/article"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" ><i class="glyphicon glyphicon-home"></i> 全部</button></a>
                    <div class="form-group">
                        <input type="text" class="form-control" name="title" placeholder="文章标题" value="">
                    </div>
                    <button type="submit" class="btn btn-default">筛选</button>
                </form>
            </div>
            <div class="row">
                <div class="col-sm-12 col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading no-collapse">课程列表</div>
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th width="5%">编号</th>
                                <th>文章标题</th>
                                <th>用户名称</th>
                                <th>评论内容(点击可查看)</th>
                                <th>评分</th>

                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!is_array($list))
                            @foreach($list as $v)
                                <tr>
                                    <td>{{$v->id}}</td>
                                    <td><?php echo get_article_name($v->article_id);?></td>
                                    <td>{{$v->user_name}}</td>
                                    <td class="autocut" data-attr="{{$v->content}}">{{$v->content}}</td>                              
                                    <td>{{$v->score}}</td>
                                    <td>
                                        <a href='/comment/article_destroy?id={{$v->id}}'>删除</a>
                                    </td>
                                </tr>
                            @endforeach
                            @endif
                            </tbody>

                        </table>

                    </div>
                    {{$list->appends(['title'=>$title])->render()}}
                </div>
            </div>
          
        </div>
    </div>
    <script type="text/javascript">
            $(".autocut").click(function(){
                var obj = $(this);
                var data = obj.attr("data-attr");
                swal(data);
            })
    </script>
@endsection